<?php
namespace app\home\model;
use think\Model;

class CourseCodeModel extends Model
{
	protected $table  = 'qm_course_code';


	/**
	*
	*查找课程可使用的兑换码 - 一条信息
	**/
	public function getCourseCodeInfo($where, $field = '*')
	{
		$info = $this->where($where)->field($field)->order('add_time ASC')->find();
		return $info;
	}



	/**
	*
	*更新兑换码信息
	**/
	public function updateCourseCodeWhereId($where, $update)
	{
		$res = $this->where($where)->update($update);
		return $res;
	}



	/**
	*
	*查找订单的兑换码
	**/
	public function getOrderCodeInfo($id, $field = '*')
	{
		$info = $this->where('id', '=', $id)->field($field)->find();
		return $info;
	}



}
